package org.linlinjava.litemall.db.util;

/**
 * @author wf_sxf@163.com
 * @date 2018-07-03 8:31
 */
public enum WithdrawEnum {
    examine("0","待审核"), success("1","提现成功"), fail("2","审核拒绝");

    WithdrawEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    private String code;

    private String name;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    /**
     * 根据code的值获取name。
     *
     * @param code 活动状态的值
     * @return 枚举对象
     */
    public static String getNameByCode(String code) {
        WithdrawEnum[] allStatus = WithdrawEnum.values();
        for (WithdrawEnum ws : allStatus) {
            if (ws.getCode().equalsIgnoreCase(code)) {
                return ws.getName();
            }
        }
        throw new IllegalArgumentException("code非法，没有符合关系类型的枚举对象");
    }
}
